<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>汽车后台管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Badge Sign In Form template Responsive, Login form web template,Flat Pricing tables,Flat Drop downs  Sign up Web Templates, Flat Web Templates, Login sign up Responsive web template, SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Custom Theme files -->
<link href="<%=request.getContextPath()%>/static/css/style.css" rel="stylesheet" type="text/css" />
<!-- //Custom Theme files -->
<!-- web font -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'><!--web font-->
<!-- //web font -->
</head>

<script src="/static/js/jquery.min.js"></script>
<script>
    function keyLogin(){
        if (event.keyCode==13)  //回车键的键值为13
           $("#btn").click(); //调用登录按钮的登录事件
    }
    function check() {
        $.ajax({
            type: "POST",
            url: "/user/login",    //向后端请求数据的url
            data: {username:$("#username").val(),userpwd:$("#userpwd").val()},
            success: function (data) {
                if(data==0){
                    location.href="/user/index"
                }else if(data==1){
                    $("#meg").text("用户不存在，登录失败");
                }else if(data==2){
                    $("#meg").text("用户密码不相符，登录失败");
                }
            }
        });
    }

</script>

<body onkeydown="keyLogin();">

	<!-- main -->
	<div class="main"> 
		<div class="login-form">
			<h2>天天租车后台管理</h2>
			<div class="agileits-top">
					<div style="color: #ff5c52" id="meg"></div>
					<div class="styled-input">
						<input type="text" id="username" name="username" value="${username}" required=""/>
						<label>用户名</label>
						<span></span>
					</div>
					<div class="styled-input">
						<input type="password" id="userpwd" name="userpwd" value="${userpwd}" required=""/>
						<label>密码</label>
						<span></span>
					</div> 
					<div class="wthree-text"> 
						<ul> 
							<li>
								<input type="checkbox" id="brand" value="">
								<label for="brand"><span></span> 记住密码</label>  
							</li>
							<!-- <li> <a href="#">Forgot password?</a> </li> -->
						</ul>
						<div class="clear"></div>
					</div>  
			</div>
			<div class="agileits-bottom" >
				
					<input type="submit" id="btn" value="登录" onclick="check()">
			</div>
		</div>
	</div>
	<!-- //main -->
	<!-- copyright -->
	<div class="copyright">
	
	</div>
</body>
</html>